<style>
  .layui-form-item-botton {
    margin-bottom: 0px;
  }

  order-detail-left .layui-form-mid, .order-detail-left .layui-word-aux {
    display: inline-block;
    height: 24px;
    line-height: 24px;
    padding: 0 !important;
  }
  .order-detail-left .layui-form-label {
    width: 200px;
    height: 24px;
    line-height: 24px;
    padding: 0 10px 0 0;
    box-sizing: border-box;
    color: #454545 !important;
  }
  .order-detail .layui-input-block{margin-left:75px;min-height:auto!important}
  .order-detail .layui-form-label{padding:0px 0!important;color:#999!important;width:auto !important;text-align:right!important}
  /* .order-detail .layui-form-mid{padding:3px 0!important} */
  .order-detail .layui-form-item{margin-bottom:0!important}
  .order-detail .order-detail-hr{border-bottom:1px solid #f6f6f6;margin-bottom:8px!important}
  .order-detail .layui-card{box-shadow:unset}
  .order-detail-operation .layui-card{margin-left:40px}
  .order-detail .layui-card .layui-card-header{font-weight:700;height:30px;line-height:30px;border-bottom:none}
  .order-detail-operation{background-color:#FFF;margin-top:5px}
  .order-detail-operation .layui-card .layui-card-body{padding:1px 15px!important;position:relative;border-bottom:none}
  .order-detail-operation .layui-card .layui-card-body .order-detail-tips{font-size:12px;color:#999!important;margin-bottom:30px}
  .order-detail-operation .layui-card .layui-card-body i{position:absolute;left:-22px;top:-22px;font-size:28px!important;color:#ff8143;}
  .order-detail-left{border-right:1px solid #EAEAEA}
  .order-detail-info{position:relative;background-color:#FFF;border:1px solid #EAEAEA;padding:10px}
  .order-detail-dl{position:absolute;font-size:12px;color:#999!important;bottom:20px;right:1.67%;left:35%;padding:10px;border-top:1px solid #f6f6f6}
  .order-detail-dl dl dt{color:#ff8143;height:25px;line-height:25px}
  .order-detail-dl dl dd{height:18px;line-height:18px}
  .order-detail-total{margin-top:20px;border-top:1px solid #EAEAEA;border-bottom:1px solid #EAEAEA;padding-top:20px;padding-bottom:20px;font-size:12px;color:#666}
  .order-detail-total span{color:#FF5722}
  .order-step-1,.order-step-2,.order-step-3,.order-step-4{position:relative;vertical-align:baseline;text-align:center}
  .order-step-1::after,.order-step-1::before,.order-step-2::after,.order-step-2::before,.order-step-3::after,.order-step-3::before,.order-step-4::after,.order-step-4::before{position:absolute;left:0;top:36px;display:block;content:' ';width:50%;height:4px;background:#999;z-index:1}
  .order-step-1::after,.order-step-2::after,.order-step-3::after,.order-step-4::after{left:50%}
  .order-step-1::before,.order-step-4::after{width:0}
  .order-step-num{position:relative;display:inline-block;width:20px;text-align:center;height:20px;margin:10px 0;line-height:22px;background:#999;color:#fff;border-radius:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;z-index:2}
  .order-step-title{font-size:12px;font-weight:700;line-height:18px;color:#999}
  .order-step-meta{font-size:12px;line-height:18px;color:#ccc}
  .order-step{margin-bottom:50px;background-color:#FFF;padding:20px}
  .order-step-active .order-step-title{color:#ff8143}
  .order-step-active .order-step-num{background:#ff8143}
  .order-step-active::after,.order-step-active::before{background:#ff8143}
  .order-step{border:1px solid #EAEAEA}

  .order-money-box div{text-align:right;padding:5px;}


  .settlement-view{background-color:#fff}
  .settlement-inner-content-item{margin-bottom:6px;display:-ms-flexbox;display:flex;color:#999!important}
  .settlement-inner-content-item-label{-ms-flex-negative:0;flex-shrink:0;width:120px;text-align:left;vertical-align:top}
  .settlement-inner-content-item-label-value{vertical-align:top;-ms-flex-positive:1;flex-grow:1;word-break:break-all;max-width:300px}
  .nav-title{font-weight:700;height:40px;line-height:40px}

  .layui-form-mid, .layui-word-aux {height: auto;}


  .invoice-title{font-weight:700;margin-bottom:8px}
  .invoice-box{padding:0;font-size:12px;max-width:340px;line-height:21px}
  .invoice-item .invoice-label{color:#646566;display:inline-block;min-width:60px}
  .invoice-item .invoice-content{display:inline;white-space:pre-wrap;word-break:break-all}
  .invoice-money{color:#d40000}
  .invoice-view{border: 1px solid #EAEAEA;padding:25px;}

</style>
<title>订单信息</title>
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href=""></a>
    <a><cite>订单信息</cite></a>
  </div>
</div>
<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">订单信息</div>
        <div class="layui-card-body">
          <div class="ns-body-content">
            <div class="order-detail">
              <div class="layui-row layui-col-space1 order-detail-info">
                <div class="layui-col-md4 order-detail-left">
                  <div class="layui-card">
                    <div class="layui-card-header nav-title">订单信息</div>
                    <div class="layui-card-body">
                      <div class="layui-form">
                        <div class="layui-form-item">
                          <label class="layui-form-label">订单编号：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">{$order.order_sn}<a type="button" class="layui-btn layui-btn-xs layui-btn-primary layui-hide" href="javascript:printDeliverOrder(1);">打印发货单</a>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item layui-hide" >
                          <label class="layui-form-label">订单类型：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">普通订单</div>
                            </div>

                          </div>
                        </div>
                        <div class="layui-form-item layui-hide">
                          <label class="layui-form-label">订单来源：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p>H5</p>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item">
                          <label class="layui-form-label">付款方式：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">{$order.payment.name}</div>
                            </div>

                          </div>
                        </div>
                        <div class="layui-form-item">
                          <label class="layui-form-label">买家：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux"><a class="ns-text-color" >{$order.user.nickname}</a></div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item order-detail-hr">

                        </div>
                        <div class="layui-form-item">
                          <label class="layui-form-label">配送方式：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p>物流配送</p>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item">
                          <label class="layui-form-label">收货人：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p>{$order.address.surname} {$order.address.name} {$order.address.surname_read} {$order.address.name_read}</p>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item">
                          <label class="layui-form-label">联系电话：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p>{$order.address.mobile}</p>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item">
                          <label class="layui-form-label">收货地址：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p>[{$order.address.zip_code}]{$order.address.address} {$order.address.detail}</p>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item order-detail-hr">

                        </div>
                        <div class="layui-form-item layui-hide">
                          <label class="layui-form-label">营销活动：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p></p>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="layui-form-item">
                          <label class="layui-form-label">买家备注：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p>{$order.remark|default='-'}</p>
                              </div>
                            </div>
                          </div>
                        </div>

                        <div class="layui-form-item">
                          <label class="layui-form-label">卖家备注：</label>
                          <div class="layui-input-block">
                            <div class="layui-inline">
                              <div class="layui-form-mid layui-word-aux">
                                <p>{$order.store_remark|default='-'}</p>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="layui-col-md8 order-detail-operation">
                  <div class="layui-card">
                    <div class="layui-card-header">订单状态： {switch order.status}
                      {case 1}待支付{/case}
                      {case 2}待发货{/case}
                      {case 3}待确认{/case}
                      {case 5}交易完成{/case}
                      {case 0}交易关闭{/case}
                      {default /}未知
                      {/switch}</div>
                    <div class="layui-card-body">
                      <p class="order-detail-tips"></p>


                      <i class="layui-icon  layui-icon-about"></i>
                    </div>
                  </div>
                </div>
                <div class="order-detail-dl">
                  <dl>
                    <dt>提醒：</dt>
                    <dd>-</dd>
                  </dl>
                </div>
              </div>
            </div>
            <div style="height: 15px;"></div>

            <div class="order-detail-table">
              <table class="layui-table" lay-filter="parse-table-order-product" lay-skin="line" lay-size="lg">
                <thead>
                <tr>
                  <th>商品</th>
                  <th>规格</th>
                  <th>单价</th>
                  <th>数量</th>
                  <th>小计（日元）</th>
                  <th>成交（日元）</th>
                  <th>退款状态</th>
                </tr>
                </thead>
                <tbody>

                {volist name='order.goods' id='vo'}
                <tr>
                  <td>{$vo.title}</td>
                  <td>
                    {php} $sku_spec_format = json_decode($vo['sku_spec_format'],true); {/php}
                      {volist name='sku_spec_format' id='sku_spec'}
                    <em style="text-decoration:underline ">{$key}：{$sku_spec}</em>&nbsp;&nbsp;&nbsp;
                      {/volist}
                  </td>
                  <td>{$vo.price/$vo.number}</td>
                  <td>{$vo.number}</td>
                  <td>{$vo.price}</td>
                  <td style="color: red">{$vo.real_price}</td>
                  <td> {$vo.is_refund?'是':'否'} </td>
                </tr>
{/volist}
                </tbody>
              </table>

              <div class="layui-row order-detail-total">
                <div class="layui-col-md9">
                  &nbsp;订单共&nbsp;<em style="color: red">{$order.number}</em>&nbsp;件商品
                </div>
                <div class="layui-col-md3 order-money-box">
                  <div>商品总额：￥{$order.good_amount}</div>
                  <div>优惠券：￥{$order.coupon_amount}</div>
                  <div>活动折扣：￥{$order.discount_amount}</div>
                  <div>店铺调价：￥{$order.store_amount}</div>
                  <div>总优惠：￥{$order.promotion_amount}</div>
                  <div>配送费用：￥{$order.shipping_amount}</div>
                  <div>实付金额：<span>￥{$order.real_amount}</span></div>
                </div>
              </div>
            </div>

            <script type="text/javascript">
              var laytpl;
              var form;
              //渲染模板引擎
              layui.use(['laytpl','form','admin','forum',"element"], function(){
                var laytpl = layui.laytpl,admin = layui.admin
                        ,view = layui.view
                        ,form = layui.form
                        ,element = layui.element;
                var $ = layui.$;
                var form = layui.form;
                form.render();


                $(".cancel_{$order.id}").click(function (){
                  var url = "merchant/Order/cancel?id={$order['id']}&m=merchant&_namespace_filter'=>'send_'{$order['id']}";
                  $.ajax({
                    url:url, //请求的url地址
                    dataType:"json", //返回格式为json
                    async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                    type:"POST", //请求方式
                    data: {
                      id:"{$order.id}"
                    }, //请求方式
                    success:function(req){
                      //请求成功时处理
                      if ( 0 == req.code || 200 == req.code)
                      {
                        layer.msg(req.message, {}, function () {
                          if (req.code == 0) {
                            window.location.reload();
                            layer.close(index);
                          }
                        });
                      }
                      else{
                        layer.msg(req.message);
                      }
                    },
                    complete:function(){
                      //请求完成的处理
                    },
                    error:function(err){
                      //请求出错处理
                      layer.msg(JSON.stringify(err));
                    }
                  });


                })


                $(".delete_{$order.id}").click(function (){
                  var url = "merchant/Order/delete?id={$order['id']}&m=merchant&_namespace_filter'=>'send_'{$order['id']}";
                  $.ajax({
                    url:url, //请求的url地址
                    dataType:"json", //返回格式为json
                    async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                    type:"POST", //请求方式
                    data: {
                      id:"{$order.id}"
                    }, //请求方式
                    success:function(req){
                      //请求成功时处理
                      if ( 0 == req.code || 200 == req.code)
                      {
                        layer.msg(req.message, {}, function () {
                          if (req.code == 0) {
                            window.location.reload();
                            layer.close(index);
                          }
                        });
                      }
                      else{
                        layer.msg(req.message);
                      }
                    },
                    complete:function(){
                      //请求完成的处理
                    },
                    error:function(err){
                      //请求出错处理
                      layer.msg(JSON.stringify(err));
                    }
                  });


                })


                $(".amount_fix_{$order.id}").click(function (){

                  var url = "merchant/Order/amount?id={$order['id']}&m=merchant&_namespace_filter'=>'send_'{$order['id']}";
                  admin.popup({
                    title: '订单发货'
                    ,area: ['800px', '500px']
                    ,id: 'LAY-popup-workorder-add-{$order.id}'
                    ,success: function(layero, index){
                      view(this.id).render(url).done(function(){
                        form.render(null, 'layuiadmin-form-workorder');
                        //监听提交
                        form.on('submit({$order[\'id\']})', function(data){
                          console.log(121);
                          var field = data.field; //获取提交的字段
                          //提交 Ajax 成功后，关闭当前弹层并重载表格
                          $.ajax({
                            url:url, //请求的url地址
                            dataType:"json", //返回格式为json
                            async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                            type:"POST", //请求方式
                            data:field,
                            success:function(req){
                              //请求成功时处理
                              if ( 0 == req.code)
                              {
                                layer.msg(req.message, {}, function () {
                                  if (req.code == 0) {
                                    window.location.reload();
                                    layer.close(index);
                                  }
                                });
                              }else{
                                layer.msg(req.message);
                              }
                            },
                            complete:function(){
                              //请求完成的处理
                            },
                            error:function(err){
                              //请求出错处理
                              layer.msg(JSON.stringify(err));
                            }
                          });

                          //$.ajax({});
                        });
                      });
                    }
                  });
                })

                $(".send_{$order.id}").click(function (){

                  var url = "merchant/Order/send?id={$order['id']}&m=merchant&_namespace_filter=send_{$order['id']}";
                  admin.popup({
                    title: '订单发货'
                    ,area: ['800px', '500px']
                    ,id: 'LAY-popup-workorder-add-{$order.id}'
                    ,success: function(layero, index){
                      view(this.id).render(url).done(function(){
                        form.render(null, 'layuiadmin-form-workorder');
                        //监听提交
                        form.on('submit({$order[\'id\']})', function(data){
                          console.log(121);
                          var field = data.field; //获取提交的字段
                          //提交 Ajax 成功后，关闭当前弹层并重载表格
                          $.ajax({
                            url:url, //请求的url地址
                            dataType:"json", //返回格式为json
                            async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                            type:"POST", //请求方式
                            data:field,
                            success:function(req){
                              //请求成功时处理
                              if ( 0 == req.code)
                              {
                                layer.msg(req.message, {}, function () {
                                  if (req.code == 0) {
                                    window.location.reload();
                                    layer.close(index);
                                  }
                                });
                              }else{
                                layer.msg(req.message);
                              }
                            },
                            complete:function(){
                              //请求完成的处理
                            },
                            error:function(err){
                              //请求出错处理
                              layer.msg(JSON.stringify(err));
                            }
                          });

                          //$.ajax({});
                        });
                      });
                    }
                  });
                })

                $(".order_remark").click(function (){

                  layer.prompt({
                    formType: 2,
                    value: "{$order.store_remark}",
                    title: '卖家备注',
                    area: ['400px', '100px'], //自定义文本域宽高
                    yes: function(index, layero){
                      var value = layero.find(".layui-layer-input").val();
                      if(value.trim().length == 0){
                        layer.msg("请填写备注！");
                        return false;
                      }
                      $.ajax({
                        type: "post",
                        url: "{:url('Order/remark')}",
                        async: true,
                        dataType: 'json',
                        data: {id : "{$order.id}", 'store_remark' : value,'remark':"{$order.remark}"},
                        success: function (res) {
                          layer.msg(res.message, {}, function () {
                            if (res.code == 0) {
                              layer.close(index);
                            }
                          });
                        }
                      })
                    }
                  });
                });

              });
              /**
               * 发货
               * @param fun
               * @param order_data
               */
              function send(){

                $.ajax({
                  url:url, //请求的url地址
                  dataType:"json", //返回格式为json
                  async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                  type:"POST", //请求方式
                  data:data, //请求方式
                  success:function(req){
                    //请求成功时处理
                    if ( 0 == req.code || 200 == req.code)
                    {
                      location.reload();
                    }
                    else{
                      layer.msg(req.message);
                    }
                  },
                  complete:function(){
                    //请求完成的处理
                  },
                  error:function(err){
                    //请求出错处理
                    layer.msg(JSON.stringify(err));
                  }
                });
              }

              /**
               * 订单操作
               * @param fun
               * @param order_data
               */
              function orderAction(fun, order_id){
                eval(fun+"("+order_id+")");
              }

              //打印发货单
              function printDeliverOrder(order_id){

                var url = ("shop/printer/batchprintorder",{order_id: order_id});

                var LODOP=getLodop();
                LODOP.PRINT_INIT("发货单打印");
                LODOP.ADD_PRINT_TBURL(5,10,"770","95%",url);
                LODOP.SET_PRINT_STYLEA(0,"HOrient",3);
                LODOP.SET_PRINT_STYLEA(0,"VOrient",3);
                LODOP.ADD_PRINT_TEXT(590,680,130,22,"页号：第#页/共&页");
                LODOP.SET_PRINT_STYLEA(0,"ItemType",2);
                LODOP.SET_PRINT_STYLEA(0,"Horient",1);
                LODOP.SET_PRINT_STYLEA(0,"Vorient",1);
                LODOP.SET_SHOW_MODE("MESSAGE_GETING_URL",""); //该语句隐藏进度条或修改提示信息

                LODOP.PREVIEW(); //预览
              }

              /**
               * 关闭订单
               * @param order_id
               */
              function orderClose(order_id){
                layer.confirm('确定要关闭该订单吗?', function() {
                  $.ajax({
                    url: ("shop/order/close"),
                    data: {order_id : order_id},
                    dataType: 'JSON',
                    type: 'POST',
                    success: function(res) {
                      layer.msg(res.message);

                      if (res.code == 0) {
                        location.reload();
                      }
                    }
                  });
                }, function () {
                  layer.close();
                });
              }

              /**
               * 线下支付
               * @param order_id
               */
              function offlinePay(order_id){
                $.ajax({
                  url: ("shop/order/offlinePay"),
                  data: {order_id : order_id},
                  dataType: 'JSON',
                  type: 'POST',
                  success: function(res) {
                    layer.msg(res.message);

                    if (res.code == 0) {
                      location.reload();
                    }
                  }
                });
              }
              /**
               * 删除订单
               * @param order_id
               */
              function orderDelete(order_id){
                layer.confirm('确定要删除该订单吗?', function() {
                  $.ajax({
                    url: ("shop/order/delete"),
                    data: {order_id : order_id},
                    dataType: 'JSON',
                    type: 'POST',
                    success: function(res) {
                      layer.msg(res.message);

                      if (res.code == 0) {
                        location.reload();
                      }
                    }
                  });
                }, function () {
                  layer.close();
                });
              }

              /**
               * 确认收货
               * @param order_id
               */
              function takeDelivery(order_id){
                layer.confirm('确保买家已经收到您的商品，并且与买家协商完毕提前确认收货?', function() {
                  $.ajax({
                    url: ("shop/order/takeDelivery"),
                    data: {order_id : order_id},
                    dataType: 'JSON',
                    type: 'POST',
                    success: function(res) {
                      layer.msg(res.message);
                      if (res.code == 0) {
                        location.reload();
                      }
                    }
                  });
                }, function () {
                  layer.close();
                });
              }
            </script>
            <script>
              var form;
              /**
               * 订单调价
               */
              function orderAdjustMoney(order_id) {
                $.ajax({
                  type: "post",
                  url: ("shop/order/getOrderDetail"),
                  async: true,
                  dataType: 'json',
                  data: {
                    "order_id": order_id
                  },
                  success: function (res) {
                    if(res.code == 0){
                      //获取模板
                      var getTpl = $("#adjust_price_html").html();
                      var data = res.data;
                      //渲染模板
                      laytpl(getTpl).render(data, function(html) {
                        layer.open({
                          type: 1,
                          shadeClose: true,
                          shade: 0.3,
                          offset: 'auto',
                          scrollbar: true,
                          fixed: false,
                          title: "调整价格",
                          area: ['1250px', 'auto'],
                          btn: ['确定', '取消'],
                          yes: function(index, layero){
                            $("#submit_price").click();
                          },
                          btn2: function(index, layero){
                            layer.close(index);
                          },
                          content:  html,
                          cancel: function(){
                            //右上角关闭回调
                            //return false 开启该代码可禁止点击该按钮关闭
                          },
                          success: function(layero, index){
                            var repeat_flag = false;//防重复标识
                            form.render();

                            form.on('submit(submit_price)', function(data){
                              if(repeat_flag)return;
                              repeat_flag = true;

                              $.ajax({
                                url: ("shop/order/adjustPrice"),
                                type: "POST",
                                dataType: "JSON",
                                async: false,
                                data: data.field,
                                success: function (res) {
                                  layer.msg(res.message);
                                  if(res.code == 0){
                                    layer.closeAll();
                                    location.reload();
                                  }else{
                                    repeat_flag = false;
                                  }

                                }
                              });
                              return false;
                            });
                          }
                        });
                        form.render();
                      });
                    }
                  }
                })

              }


            </script>

            <!-- 发货 -->
            <!-- 订单物流发货 -->
            <style>
              .delivery-box {
                padding: 20px; /*border-bottom:1px solid #e6e6e6;*/
              }

              .layui-table-body {
                overflow: unset;
              }

              .delivery-content {
                padding: 7px 0 !important;
              }

              .layui-table-view {
                border-top: 1px solid #eee;
                border-bottom: 1px solid #eee;
              }

              .order-delivery .layui-table { /*margin-bottom: 30px;*/
              }

              .layui-form .order_goods_list thead th, .layui-form #order_goods_list tbody tr {
                border-bottom: 1px solid #E6E6E6;
              }

              .layui-form .order_goods_list thead th {
                background-color: #F5F5F5;
                line-height: 30px;
              }

              #order_goods_list_box, #order_goods_list_box1 {
                overflow: hidden;
              }

              #order_goods_list_box table, #order_goods_list_box1 table {
                margin: 0;
              }

              #order_goods_list_box table:nth-of-type(2), #order_goods_list_box1 table:nth-of-type(2) {
                display: block;
                overflow: auto;
                max-height: 300px;
              }

              .order-delivery .ns-input-text {
                height: auto;
                min-height: 34px;
              }

              .table-height {
                height: 200px;
                overflow: auto;
              }
              .edit-delivery-box table{
                margin: 0;
              }
              .edit-delivery-box table:last-of-type{
                display: block;
                height: 430px;
                overflow: auto;
              }
            </style>
            <!--发送订单弹出框-->
            <script type="text/html" id="order_delivery_html">
              <div class="order-delivery">
                <div class="layui-form">
                  <div class="layui-form-item" style="display:none;">
                    <div class="layui-form-mid layui-word-aux delivery-content">
                      待发货<span class="delivery-count">0</span>，已选<span class="deliveryed_count">0</span>
                    </div>
                  </div>

                  <input type="hidden" name="type" value="manual">

                  <div class="layui-form-item">
                    <label class="layui-form-label">收货地址：</label>
                    <div class="layui-input-block">
                      <p class="ns-input-text ns-len-long"> {{ d.order_info.full_address }}{{ d.order_info.address }}</p>
                    </div>
                  </div>

                  <div class="layui-form-item delivery-type">
                    <label class="layui-form-label">发货方式：</label>
                    <div class="layui-input-block">
                      <input type="radio" lay-filter="delivery_type" name="delivery_type" value="1" title="物流发货" checked>
                      <input type="radio" lay-filter="delivery_type" name="delivery_type" value="0" title=无需物流>
                    </div>
                  </div>

                  <div class="express-type">
                    <div class="layui-form-item logistics-company">
                      <label class="layui-form-label">物流公司：</label>
                      <div class="layui-input-block ns-len-mid">
                        <select name="express_company_id" lay-search lay-filter="express_company">
                          <option value="">请选择物流公司</option>
                          {{# layui.each(d.express_company, function(index, item){ }}
                          <option value="{{ item.company_id }}">{{ item.company_name }}</option>
                          {{# }); }}
                        </select>
                      </div>
                    </div>

                    <div class="layui-form-item express-number">
                      <label class="layui-form-label">快递单号：</label>
                      <div class="layui-input-block">
                        <input type="text" name="delivery_no" placeholder="" autocomplete="off" class="layui-input ns-len-mid">
                      </div>
                    </div>
                  </div>

                  <div class="ns-form-row">
                    <button type="button" class="layui-btn" lay-submit id="button_delivery_order" lay-filter="button_delivery_order" style="display:none;">保存</button>
                  </div>

                  <div id="order_goods_list_box">
                    <table class="layui-table order_goods_list" lay-filter="order_goods" lay-skin="line" lay-filter="order_goods_list">
                      <colgroup>
                        <col width="5%">
                        <col width="38%">
                        <col width="15%">
                        <col width="27%">
                        <col width="15%">
                      </colgroup>
                      <thead>
                      <tr>
                        <th><input type="checkbox" lay-skin="primary" lay-filter="selectAllTop"/></th>
                        <th>商品名称</th>
                        <th>数量</th>
                        <th>物流单号</th>
                        <th>物流状态</th>
                      </tr>
                      </thead>
                    </table>
                    <table class="layui-table order_goods_list" lay-filter="order_goods" lay-skin="line" lay-filter="order_goods_list">
                      <colgroup>
                        <col width="5%">
                        <col width="38%">
                        <col width="15%">
                        <col width="27%">
                        <col width="15%">
                      </colgroup>
                      <tbody>
                      {{# layui.each(d.order_goods_list, function(index, item){ }}
                      <tr>
                        <td><input type="checkbox" lay-skin="primary" class="order_goods_id" lay-filter="select{{ item.order_goods_id }}" value="{{ item.order_goods_id }}" {{# if(item.delivery_status !=0){ }} disabled {{# } }}/></td>
                        <td>{{ item.sku_name }}</td>
                        <td>{{ item.num }}</td>
                        <td>{{ item.delivery_no }}</td>
                        <td>{{ item.delivery_status_name }}</td>
                      </tr>
                      {{# }); }}
                      {{# if(d.order_goods_list.length === 0){ }}
                      <tr>
                        <td colspan="5" align="center">无数据</td>
                      </tr>
                      {{# } }}
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </script>

            <!-- 批量订单发货 -->
            <script type="text/html" id="order_batch_delivery_html">
              <div class="order-delivery">
                <div class="layui-form">

                  <input type="hidden" name="type" value="manual">
                  <input type="hidden" name="sheet_exists" value="2">

                  <div class="layui-form-item  delivery-type">
                    <label class="layui-form-label">发货方式：</label>
                    <div class="layui-input-inline">
                      <input type="radio" lay-filter="delivery_type" name="delivery_type" value="1" title="物流发货" checked>
                      <input type="radio" lay-filter="delivery_type" name="delivery_type" value="0" title=无需物流>
                    </div>
                  </div>


                  <div class="express-type">
                    <div class="layui-form-item logistics-company ">
                      <label class="layui-form-label">物流公司：</label>
                      <div class="layui-input-block ns-len-mid">
                        <select name="express_company_id" lay-search lay-filter="express_company">
                          <option value="">请选择物流公司</option>
                          {{# layui.each(d.express_company, function(index, item){ }}
                          <option value="{{ item.company_id }}">{{ item.company_name }}</option>
                          {{# }); }}
                        </select>
                      </div>
                    </div>
                  </div>

                  <div class="ns-form-row">
                    <button type="button" class="layui-btn" lay-submit id="button_delivery_order" lay-filter="button_delivery_order" style="display:none;">保存</button>
                  </div>

                  <div id="order_goods_list_box">
                    <table class="layui-table order_goods_list" lay-filter="order_goods" lay-skin="line">
                      <colgroup>
                        <col>
                        <col width="30%">
                        <col width="50%">
                        <col width="20%">
                      </colgroup>
                      <thead>
                      <tr>
                        <th></th>
                        <th>订单号</th>
                        <th>收货地址</th>
                        <th>操作</th>
                      </tr>
                      </thead>
                    </table>

                    <table class="layui-table order_goods_list" lay-filter="order_goods" lay-skin="line">
                      <colgroup>
                        <col width="">
                        <col width="30%">
                        <col width="50%">
                        <col width="20%">
                      </colgroup>
                      <tbody>
                      {{# layui.each(d.order_goods_list, function(index, item){ }}
                      <tr>
                        <td></td>
                        <td>{{ item.order_no }}</td>
                        <td>{{ item.full_address }}</td>
                        <td><a href="javascript:;" class="ns-text-color goods-item-remove" data-order-id="{{item.order_id}}">删除</a></td>
                      </tr>
                      {{# }); }}
                      {{# if(d.order_goods_list.length === 0){ }}
                      <tr>
                        <td colspan="3" align="center">无数据</td>
                      </tr>
                      {{# } }}
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </script>

            <!-- 修改物流单号 -->
            <script type="text/html" id="order_edit_delivery">
              <div class="edit-delivery-box layui-form">
                <table class="layui-table">
                  <colgroup>
                    <col width="30%">
                    <col width="30%">
                    <col width="40%">
                  </colgroup>
                  <thead>
                  <tr>
                    <th>序号</th>
                    <th>物流公司</th>
                    <th>快递单号</th>
                  </tr>
                  </thead>
                </table>
                <table class="layui-table">
                  <colgroup>
                    <col width="30%">
                    <col width="30%">
                    <col width="40%">
                  </colgroup>
                  <tbody>
                  {{#for(var i = 0; i < d.editDeliveryData.length; i++){ }}
                  <tr>
                    <td>{{d.editDeliveryData[i].id}}</td>
                    <td>
                      <select>
                        {{#for(var j = 0; j < d.express_company.length; j++){ }}
                        {{# if(d.express_company[j].company_id == d.editDeliveryData[i].express_company_id){ }}
                        <option selected value="{{d.express_company[j].company_id}}">{{d.express_company[j].company_name}}</option>
                        {{# }else{ }}
                        <option value="{{d.express_company[j].company_id}}">{{d.express_company[j].company_name}}</option>
                        {{# } }}
                        {{# } }}
                      </select>
                    </td>
                    <td>
                      <input type="text"  class="layui-input" value="{{d.editDeliveryData[i].delivery_no}}">
                    </td>
                  </tr>
                  {{# } }}
                  </tbody>
                </table>
              </div>
            </script>



          </div>
        </div>



      </div>
    </div>
  </div>
</div>

<script>

  layui.define(['form', 'upload'], function(exports) {
            var $ = layui.$
                    , layer = layui.layer
                    , laytpl = layui.laytpl
                    , setter = layui.setter
                    , view = layui.view
                    , element = layui.element
                    , admin = layui.admin
                    , form = layui.form
                    , upload = layui.upload;

            var $body = $('body');

            form.render();
          }
  );


</script>




